﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OPC.DA.Redis.Wrapper
{
    public class AppConfigDaClint
    {
        public AppConfigDaClint()
        {
            // Use the DefaultValue propety of each property to actually set it, via reflection.
            foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(this))
            {
                DefaultValueAttribute attr = (DefaultValueAttribute)prop.Attributes[typeof(DefaultValueAttribute)];
                if (attr != null)
                {
                    prop.SetValue(this, attr.Value);
                }
            }
        }
        [DefaultValue("127.0.0.1")]
        public string Host { get; set; }

        public string DaServer { get; set; }
        
        [DefaultValue(1000)]
        public int RequestedUpdateRate { get; set; }

        [DefaultValue(0)]
        public int defaultDatabase { get; set; }

        [DefaultValue(10000)]
        public int MaxReconnectWait { get; set; }

    }
    public class AppConfigRedis
    {
        public AppConfigRedis()
        {
            // Use the DefaultValue propety of each property to actually set it, via reflection.
            foreach (PropertyDescriptor prop in TypeDescriptor.GetProperties(this))
            {
                DefaultValueAttribute attr = (DefaultValueAttribute)prop.Attributes[typeof(DefaultValueAttribute)];
                if (attr != null)
                {
                    prop.SetValue(this, attr.Value);
                }
            }
        }
        [DefaultValue("127.0.0.1")]
        public string Host { get; set; }

        [DefaultValue(6379)]
        public int Port { get; set; }

        [DefaultValue("")]
        public string User { get; set; }

        [DefaultValue("")]
        public string Password { get; set; }

        [DefaultValue("OpcGroup")]
        public string HashRedisKey { get; set; }

        [DefaultValue(1)]
        public int KeepAlive { get; set; }


        [DefaultValue(5000)]
        public int ConnectTimeout { get; set; }
    }
}
